Skip to main content

Sample S3 Repository Plugin

What You Need

Setting Up The S3 Bucket

Create an S3 Bucket, but add these two folders in the bucket:

  • "Templates"
  • "Documents"

The S3 Bucket is now setup properly to use with this sample.

Setting up the AWS DynamoDB Table

Create a new DynamoDB table. You can name it whatever you want, but add "Guid" as the partition key as shown below:

Once that is setup, click "Create". Your DynamoDB table is now setup properly to use with this sample.

Steps For Usage

After downloading the sample project off of github, and setting up the S3 Bucket and DynamoDB table as described above, follow these steps to setup the sample project and then using it in your RESTful Engine.

Setting Up Sample Project

  1. If you havent already, shut down your installed instance of the RESTful engine.
  2. After downloadind the sample, open the Java-RESTful-S3-Repository-Sample in your preferred IDE
  3. Next, we will add your AWS credentials to the project. Open the S3Repository.java file and enter your S3 bucket name, AWS Access Key, and AWS Secret Key:

4. Navigate to `JobInfoEntity.java` , located in the `S3Storage` directory:

5. There you will set the name of your DynamoDB table as shown below:

6. Now, we will make sure that the RegionEndpoint is set correctly in the project. Change RegionEndpoint to match the region that your S3 Table is deployed . If your S3 table is **not** deployed in `US.East1`, then you will need to set the proper region in the `createClient()` method in `S3StorageManager.cs` file:

7. Build the project by runnging the following command in the command line in the `Java-RESTful-S3-Repository-Sample` directory:
mvn clean install

Then use the generated JAR in the RESTful Engine.

note

You can setup this project wherever you want, but your RESTful server must be able to access the JAR. If you build the project somewhere other than your RESTful server, make sure you place the JARs on your RESTful server.

Using DLL in RESTful Engine

You will need to get the full path to the S3Repository.jar that was generated by the build in step 7. The jar will be in the following directory:

...\Java-RESTful-S3-Repository-Sample\target\S3Repository-1.0.0-jar-with-dependencies.jar
note

You will see 2 JARs in that directory, make sure to get the one titled S3Repository-1.0.0-jar-with-dependencies.jar as it includes all the dependencies we need.

Once you've got the full path, append it to the following line of code (where it says full path to dll):

repository={FULL_PATH_TO_DLL}!S3RepositoryPlugin.S3Repository

Then you will need to add this to the WindwardReports.properties.properties file that will be found here:

...\Apache Software Foundation\Tomcat 10.0\webapps\ROOT\WEB-INF\classes\WindwardReports.properties.properties

You should be good to start up your RESTful engine now and start sending requests to it.